<?php
namespace Home\Controller;
use Think\Controller;
class RegisterController extends Controller {
    public function register(){
	    $banner=M('banner');
    	$bannerlist=$banner->select();
     	$this->assign('bannerlist',$bannerlist);
      $this->display();
    }
    public function get_v (){
      $Verify = new \Think\Verify();
      $Verify->fontSize = 36;
      $Verify->length   = 4;
      $Verify->useNoise = true;
      $Verify->entry(1);
    }
    
   public function ajaxCheckVerify(){
      $code=I('post.fleshVerify');
      $verify = new \Think\Verify();
      $res=$verify->check($code, 1);
      $checkResult=$res?true:false;
      $this->ajaxReturn($checkResult);
    }
    public function account(){
        $data['name']=$_POST['name'];
        $data['password']=$_POST['password'];
        $data['tphone']=$_POST['tphone'];
        $User = M("account"); // 实例化User对象
        $i=$User->add($data);
        // 根据表单提交的POST数据创建数据对象
        if($i){
          $this->success('注册成功', U('Index/login'));
        } else {
          //错误返回登录页
          $this->error('注册失败');
        }
     }
}